<include file="default/public/header_mini" />

<div class="reg-top-box">
  <div class="reg-top-user"><img src="__ROOT__/Apps/Wap/View/default/assets/i/reg-logo.png" width="122" height="122" /></div>
</div>
<div class="reg-form-box">
<div id="errmsg"></div>
  <div class="am-form am-form-horizontal">
    <div class="am-form-group">
      <label for="doc-ipt-3" class="am-u-sm-3 am-form-label">用户名：</label>
      <div class="am-u-sm-9">
        <input type="text" id="loginName" placeholder="请输入您的手机号">
      </div>
    </div>
    <div class="am-form-group">
      <label for="doc-ipt-pwd-2" class="am-u-sm-3 am-form-label">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
      <div class="am-u-sm-9">
        <input type="password" id="loginPwd" placeholder="请输入您的密码">
      </div>
    </div>
    <div class="am-form-group">
      <div class="am-u-sm-11 am-u-sm-offset-1">
        <button  class="am-btn am-btn-danger" style=" margin-left:13px;" onClick="toLogin()">登&nbsp;&nbsp;录</button>
        <span class="reg-link"><a href="{:U('Wap/Users/regist')}">快速注册</a></span><span class="reg-link"><a href="{:U('Wap/Users/phoneCode')}">忘记密码？</a></span> </div>
    </div>
  </div>
</div>
<script src="__ROOT__/Apps/Wap/View/default/assets/js/jquery.min.js"></script> 
<script src="__ROOT__/Apps/Wap/View/default/assets/js/amazeui.min.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">
function toLogin(){
   var params = {};
   params.loginName = $.trim($('#loginName').val());
   params.loginPwd = $.trim($('#loginPwd').val());
   if(params.loginName==''){
	   $("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入用户名!");
	   $('#loginName').focus();
	   return;
   }
   if(params.loginPwd==''){
	   $("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入密码!");
	   $('#loginPwd').focus();
	   return;
   }
    /*$.ajax({
		type:'post',
		url:"{:U('Wap/Users/toLogin')}",
		data:params,
		dataType:"json",
		success:function(data){
			alert(data.info)
			if(data.status=='1'){
				location.href= "{:U('Wap/Users/index')}";
			}else{
				$("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账号或密码错误!");
			}
		}
	})*/
   $.post("{:U('Wap/Users/toLogin')}",params,function(data,textStatus){
	   var json = MXC.toJson(data);
		if(json.code=='1'){
			location.href= json.data.referer;
		}else{
			$("#errmsg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账号或密码错误!");
		}
   });
}
</script>
</body>
</html>
